$(function () {

    var cm = [{
        // title: '选择',
        checkbox: true

    }, {
        field: 'Id',
        visible: false
    }, {
        field: 'm_icon',
        title: '图标',
        formatter: IconFormat
    }, {
        field: 'm_title',
        title: '目录名称'
        // formatter: NameFormatter
    }, {
        field: 'm_topMenu',
        width: '',
        title: '上级菜单'
    }, {
        field: 'm_group',
        title: '分组'
    }, {
        field: 'm_url',
        title: 'Url'
    }, {
        field: 'm_sort',
        title: '排序'
    }, {
        field: 'm_develop',
        title: '开发模式',
        formatter: TF_Formatter
    }, {
        field: 'm_tf',
        title: '状态',
        formatter: TF_Formatter
    }];
    goTable($('#' + goUrlAction() + 'Table'), '/admin/views/' + goUrlAction() + '/list', cm);

});
//value:代表当前单元格中的值，

//row：代表当前行,

//index:代表当前行的下标,
function IconFormat(value, row, index) {
    var tf = row.m_icon;
    return '<span class="fa ' + tf + '"></span>';
}

function TF_Formatter(value, row, index) {
    var tf = value;
    var tt
    var key = this.field;
    if (parseInt(tf) == 1) {
        tt = 'checked';
    } else {
        tt = "";
    }
    if (key == 'm_tf') {
        key = 0
    } else {
        key = 1
    }
    if (tf == 0) {
        tf = 1
    } else {
        tf = 0
    }
    var tmp
    tmp = '<label style="margin-bottom: -5px;" class="switch switch-sm switch-icon switch-pill switch-primary">';
    tmp += '<input type="checkbox" onclick="_chsta(' + tf + ',' + row.Id + ',' + key + ')" class="switch-input" ' + tt + '>';
    tmp += '<span class="switch-label" data-on="&#xf00c" data-off="&#xf00d"></span>';
    tmp += '<span  class="switch-handle"></span></label>';
    //alert(tmp);
    return [tmp].join('');
}



//Form表单验证
function menuValidatorRules(){
    var sRules
    sRules ={
        m_title: 'required'
    };
    return sRules;
}





